
#include <BMouseEvent>
#include <BImage>
#include <BPainter>
#include <BViewer>
#include <BThread>
#include <BSurface>
#include <BSphere>
#include <BCamera>
#include <BViewer>
#include <BScene>
#include <BProgram>
#include <BMaterial>
#include <BHBoxLayout>
#include <BApplication>
#include <BSphereHandler>
#include <BMainWindow>
#include <BDialog>

using namespace BWE;

class TrayDialog : public BDialog
{
public:
	TrayDialog(const BString& title)
	{
		this->setTitle(title);
		this->setFrameless(true);
		this->setBorder(10);

		_inside = false;
		_pressed = false;
		_image = new BImage("data/image/Multimedia_Icons_009.png");

	}
	~TrayDialog()
	{

	}

protected:
	virtual void paintEvent(const BEvent& event)
	{
		//BDialog::paintEvent(event);

		BRect crect = this->centerRect();
		BPainter painter(this);
		painter.setLineWidth(3);
		if (_inside)
			painter.setColor(200, 0, 200);
		else
			painter.setColor(200, 0, 0);
		painter.setLineSmooth(true);

		int size = int(crect.width() * 0.4f);
		painter.drawEllipse(crect.center(), BSize(size, size));

		size = int(crect.width() * 0.3f);
		painter.fillEllipse(crect.center(), BSize(size, size));

		painter.bind(_image);
		painter.setColor(0, 255, 0, 128);
		painter.fillRect(crect.left(), crect.top(), crect.width() / 2, crect.height());
		painter.unbind();

	}

private:
	bool		_inside;
	bool		_pressed;
	BPoint		_pressedPos;
	BImage*		_image;
};

int main(int argc, char** argv)
{
	BApplication app;

	BWidget wgt("fuck");
	wgt.setSize(600, 500);
	wgt.show();
	
	//TrayDialog window("������");
	//window.setFrameless(true);
	//window.setBorder(6);
	//window.setMargin(2, 2, 2, 2);
	//window.setSize(500, 400);
	//window.show();

	return app.execute();
}
